﻿

<!--********************* Part1:Jsp Head *********************-->

<%@ page contentType="text/html;charset=UTF-8"%>  
<%@ include file="/framework/head.jsp"%>

<!--********************* Part2:Java Code *********************-->
<%
    StorageMonthOutSearchEvent event = (StorageMonthOutSearchEvent)context.getSessionValue("StorageMonthOutSearchEvent");
    ObjectList list = StorageMonthOut.fetch().search(con,event);
%>

<!--********************* Part3:JavaScript Code ***************-->
<!--start 客户端脚本区域-->
<%@page import="system.base.StorageMonthOutSrv"%>
<%@page import="java.util.Vector"%>
<%@page import="system.data.StorageMonthOutPageData"%>
<%@page import="system.base.WarehouseProduct"%>
<%@page import="system.base.Warehouse"%>
<%@page import="system.base.ProductCategory"%>
<%@page import="framework.core.StringUtil"%>
<script language=javascript>

var list_code = "listStorageMonthOut";

function doSearch()
{

    SetValue("s_BalanceTime",GetValue("i_Year")); //结算时间
    doCommonSearch();
}


key_InitDefault();
key_RegSubmitHandler(doSearch);
</script>








<%=uiBody%>>

<%@ include file="/framework/menu.jsp"%>

<!--********************* Part4:Form  ***************-->
<form id=frm action="<%=Config.getSrv()%>" method="post">
<input type=hidden name="action_code" value="">
<input type=hidden name="Id" value="">
<input type=hidden name=sortOrder value="1">

<!--查询条件保留区域-->

<%
String time = event.getBalanceTime();
String year = time.substring(0,4);
%>
<input type=hidden name="s_BalanceTime" value="<%=event.getBalanceTime()%>"> <!--结算时间-->
<%@ include file="/framework/list_head.jsp"%>


<br>
<!--********************* Part5:Search Area ***************-->
<%=uiSearchStart%>>
<%
    int key_tab = 1 ;
%>

    <%=uiSearchInputTR%>>
        <%=uiSearchInputTDHead%>>
            选择结算年份：
        </td>
        <%=uiSearchInputTDHead%>>
            <%=SelectManager.viewYearSelect(con,"i_Year",year,false,"","-请选择-","","")%>  <input type="button" value="查询" class="buttons" onclick="doSearch();return false;">&nbsp;<input type="button" value="清空" class="buttons" onclick="doClearEvent();return false;">
        </td>       
    </tr>    

<%=uiSearchEnd%>

<!--列表标题-->
<%=UIManager.addListHeadTitle("全体公司全年分类明细")%>

<!--********************* Part6:List Area ***************--><%=uiListStart%>>
<%int index = 1 ;%>  
    <%=uiListHeadTR%>>
        <%=UIManager.addListHead("公司",index++)%>
        <%=UIManager.addListHead("类别",index++)%>
        <%=UIManager.addListHead("一月",index++)%>
        <%=UIManager.addListHead("二月",index++)%>
        <%=UIManager.addListHead("三月",index++)%>
        <%=UIManager.addListHead("四月",index++)%>
        <%=UIManager.addListHead("五月",index++)%>
        <%=UIManager.addListHead("六月",index++)%>
        <%=UIManager.addListHead("七月",index++)%>
        <%=UIManager.addListHead("八月",index++)%>
        <%=UIManager.addListHead("九月",index++)%>
        <%=UIManager.addListHead("十月",index++)%>
        <%=UIManager.addListHead("十一月",index++)%>
        <%=UIManager.addListHead("十二月",index++)%>
    <%=uiListHeadTREnd%>>
    
<%
    String menu = (String)context.getSessionValue("choice");
    Vector vec = (Vector)context.getSessionValue(menu);
    boolean isfirst = false;
    
    double[] detailMoney = new double[12];
    double[] totalMoney = new double[12];
    
    if(String.valueOf(context.getSessionValue("isfirst")) == "true"){
        isfirst = true;
    }
    
    if(!isfirst && vec != null && vec.size() > 0){//003
        for(int k = 0;k < vec.size(); k++){//002
            Vector wvec = (Vector)vec.get(k);  
            
            for(int j = 0; j < wvec.size(); j++){//001
                String[] cate = (String[])wvec.get(j);
                Warehouse warehouse = Warehouse.fetchByCode(con, cate[0]);
                if(warehouse == null) warehouse = Warehouse.fetch();
                ProductCategory category = ProductCategory.fetchByCode(con, cate[13]);
                if(category == null) ProductCategory.fetch();
%> 
                <%=uiListDataTR[j%2]%>>
<%
                if(j == 0){//004
%>
                    <%=uiListDataTD%> rowspan="<%= wvec.size() %>"><%= warehouse.viewName(con) %></td>
<%
                }//004
%>
                    <%=uiListDataTD%>><%= "自增分类".equals(category.viewName(con)) ? "其他" : category.viewName(con) %></td>
                    
<%
                 for(int i = 1; i <= 12 ;i++){//005
                     boolean check = false;
                     double money = StringUtil.strToDouble(cate[i]);
                     detailMoney[i-1] += money;
                     totalMoney[i-1] += money;
%>
                     <%=uiListDataTD%>><%= StringUtil.showPrice(money, 2) %></td>
                     <%check = true;%>
<%
                     if(!check){//006
%>
                        <%=uiListDataTD%>>&nbsp</td>
                    <%}//006 %>
                 <%}//005%> 

<%
                 if(j == wvec.size() - 1){//008
%>
                    <%=uiListDataTR[0]%>>
                        <%=uiListDataTD%> colspan="2">小计:</td>
<%
                        for(int i = 0; i < 12 ;i++){//007
                            boolean check = false;
%>    
                            <%=uiListDataTD%>><%= StringUtil.showPrice(detailMoney[i], 2) %></td>
                            <%check = true;%>
            
                            <%if(!check){//006%>
                                <%=uiListDataTD%>>&nbsp</td>
                            <%}//006 %>
                        <%}//007 %> 
                    </tr>
                <%}//008 %>
 
<%
            }//001
%>

<%
           for(int p = 0; p < detailMoney.length; p++){
               detailMoney[p] = 0;
           }
%>
            
<%
            if(k == vec.size() -1){//009
%>    
                <%=uiListDataTR[0]%>>
                    <%=uiListDataTD%> colspan="2">总计:</td>
 <%
                for(int a = 0; a < 12; a++){//010
 %>
                       
                            <%=uiListDataTD%>><%= StringUtil.showPrice(totalMoney[a], 2) %></td>    
                       
                     
                <%}//010 %>
                </tr>
<%
          }//009
%>

<%
        }//002
%>


<% 
    }//003
%>

    

<%=uiListEnd%>
</form>


<%@ include file="/framework/foot.jsp"%>

<!--
    Author    :Benny
    FileName  :/system/base/StorageMonthOutList.jsp
-->
